<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common/include.jsp"%>
<%@ page import="com.msmall.community.space.util.SpaceConstants" language="java"%>
<c:set var="SPACE_WIDGET_PART_HOME" value="<%=SpaceConstants.SPACE_WIDGET_PART_HOME%>"></c:set>
<c:set var="SPACE_WIDGET_PART_DIARY" value="<%=SpaceConstants.SPACE_WIDGET_PART_DIARY%>"></c:set>
<c:set var="SPACE_WIDGET_PART_FOOTERPRINT" value="<%=SpaceConstants.SPACE_WIDGET_PART_FOOTERPRINT%>"></c:set>
<c:set var="SPACE_WIDGET_PART_ALBUM" value="<%=SpaceConstants.SPACE_WIDGET_PART_ALBUM%>"></c:set>
<c:set var="SPACE_WIDGET_PART_ROSTER" value="<%=SpaceConstants.SPACE_WIDGET_PART_ROSTER%>"></c:set>
<c:set var="SPACE_WIDGET_PART_WORDS" value="<%=SpaceConstants.SPACE_WIDGET_PART_WORDS%>"></c:set>
<c:set var="SPACE_WIDGET_PART_PROFILE" value="<%=SpaceConstants.SPACE_WIDGET_PART_PROFILE%>"></c:set>
<c:set var="SPACE_WIDGET_PART_MESSAGE" value="<%=SpaceConstants.SPACE_WIDGET_PART_MESSAGE%>"></c:set>
<c:set var="SPACE_WIDGET_PART_TEAM" value="<%=SpaceConstants.SPACE_WIDGET_PART_TEAM%>"></c:set>

<tiles:insertDefinition name="html.mainHeader.top"></tiles:insertDefinition>

<div class="spacetop">
	<p class="spacename">
		<span><ms:user type="nickname" userid="${userInfo.userid}" nickname="${userInfo.nickname}"></ms:user>的个人空间</span>
		<br>
		<c:out value="/space/index.do?usr=${userInfo.userid}"></c:out>
		
		<c:set var="authorizeCreateWiki"><ms:wiki action="create" id="${userInfo.userid}"/></c:set>
		<c:if test="${authorizeCreateWiki eq true}">
			<a href="<c:url value='/wiki/create.do'/>">创建字典/百科</a>
		</c:if>
		<c:set var="authorizeCreateKlgArticle"><ms:klg action="create" id="${userInfo.userid}"/></c:set>
		<c:if test="${authorizeCreateKlgArticle eq true}">
			<a href="<c:url value='/klg/article/create.do'/>">创建知识</a>
		</c:if>
		<c:set var="authorizeCreateCookbookArticle">
			<ms:cookbook action="create" id="${userInfo.userid}"/>
		</c:set>
		<c:if test="${authorizeCreateCookbookArticle eq true}">
			<a href="<c:url value='/cookbook/create.do'/>">创建食谱</a>
		</c:if>
	</p>
	<div id="spaceIndexHeaderNav" class="spacenav">
		<c:set var="indicator">
			<c:choose>
				<c:when test="${isOwner}">我</c:when>
				<c:otherwise>Ta</c:otherwise>
			</c:choose>
		</c:set>
		<a id="spaceIndexNav<c:out value='${SPACE_WIDGET_PART_HOME}'/>" class="spacenava" href="javascript:spaceIndexNav(<c:out value='${SPACE_WIDGET_PART_HOME}'/>)">
			空间主页
		</a>
		<a id="spaceIndexNav<c:out value='${SPACE_WIDGET_PART_DIARY}'/>" href="javascript:spaceIndexNav(<c:out value='${SPACE_WIDGET_PART_DIARY}'/>)">
			<c:out value="${indicator}"/>的日记
		</a>
		<a id="spaceIndexNav<c:out value='${SPACE_WIDGET_PART_FOOTERPRINT}'/>" href="javascript:spaceIndexNav(<c:out value='${SPACE_WIDGET_PART_FOOTERPRINT}'/>)">
			<c:out value="${indicator}"/>的脚印
		</a>
		<a id="spaceIndexNav<c:out value='${SPACE_WIDGET_PART_ALBUM}'/>" href="javascript:spaceIndexNav(<c:out value='${SPACE_WIDGET_PART_ALBUM}'/>)">
			<c:out value="${indicator}"/>的照片
		</a>
		<a id="spaceIndexNav<c:out value='${SPACE_WIDGET_PART_ROSTER}'/>" href="javascript:spaceIndexNav(<c:out value='${SPACE_WIDGET_PART_ROSTER}'/>)">
			<c:out value="${indicator}"/>的好友
		</a>
		<a id="spaceIndexNav<c:out value='${SPACE_WIDGET_PART_WORDS}'/>" href="javascript:spaceIndexNav(<c:out value='${SPACE_WIDGET_PART_WORDS}'/>)">
			留言本
		</a>
		<c:if test="${isOwner}">
			<a id="spaceIndexNav<c:out value='${SPACE_WIDGET_PART_MESSAGE}'/>" href="javascript:spaceIndexNav(<c:out value='${SPACE_WIDGET_PART_MESSAGE}'/>)">
			系统消息
			</a>
		</c:if>
		<!-- 
		<a id="spaceIndexNav<c:out value='${SPACE_WIDGET_PART_TEAM}'/>" href="javascript:spaceIndexNav(<c:out value='${SPACE_WIDGET_PART_TEAM}'/>)">
			圈子
		</a>
		 -->
		<a id="spaceIndexNav<c:out value='${SPACE_WIDGET_PART_PROFILE}'/>" href="javascript:spaceIndexNav(<c:out value='${SPACE_WIDGET_PART_PROFILE}'/>)">
			个人资料
		</a>
	</div>
</div>
<script type="text/javascript">
function spaceIndexNav(navid){
	var nav = 'spaceIndexNav' + navid;
	$("#spaceIndexHeaderNav a").each(function(index, ele){
		if($(this).attr('id') == nav){
			$(this).addClass('spacenava');
		}else{
			$(this).removeClass('spacenava');
		}
	});
	$.ajax({
		type : "POST",
		url : '<c:url value="/space/widget.do"/>',
		data : 'part='+navid + "&usr="+'<c:out value="${userInfo.userid}"/>',
		timeout:20000,
		success : function(data){
			$('#spaceIndexContent').html(data);
		},
		error: function(){
		}
	});
}
$(document).ready(function(){
	var part = '<c:out value="${part}"/>';
	if(part != 0){
		spaceIndexNav(part);
	}else{
		spaceIndexNav("<c:out value='${SPACE_WIDGET_PART_HOME}'/>");
	}
	
});
</script>
<div id="spaceIndexContent" class="spamokuai martop5">
</div>